package com.future.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.future.entity.User;
import com.future.dao.UserMapper;
import com.future.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    /**
     * 根据用户名查询用户信息
     * @param userName
     * @return
     */
    @Override
    public User findUserByUserName(String userName) {

        //创建条件构造器
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        //设置查询条件
        queryWrapper.eq("username",userName);
        //返回查询记录
        return baseMapper.selectOne(queryWrapper);
    }
}
